<?php

class QForm extends CForm{

	public function render(){
		ob_start();

		echo '<div class="form">';
		echo $this->renderBegin();

		?>
		<fieldset>
			<legend><?=$this->title?></legend>
		<?

        foreach($this->getElements() as $element){
			
			?>
			<div class="clearfix">
            	<?=$element->renderLabel()?>
            	<div class="input">
              		<?=$element->renderInput()?>
					<span class="help-inline"><?=$element->renderError()?></span>
            	</div>
				<span class="help-block"><?=$element->renderHint()?></span>
          	</div>
			<?
		}

		?>
		</fieldset>
		<?

		echo $this->renderButtons();
        echo $this->renderEnd();
		echo '</div>';

        return ob_get_clean();
    }

	public function renderButtons()
	{
		$output='';
		foreach($this->getButtons() as $button)
			$output.=$this->renderElement($button);
		return $output!=='' ? '<div class="actions">'.$output.'</div>' : '';
	}

}